﻿using System.Collections;

namespace Magellan.Routing
{
    public class SegmentPathMatch
    {
        private readonly bool _success;
        private readonly string _failReason;
        private readonly RouteValueDictionary _parameterValues;

        private SegmentPathMatch(bool success, IDictionary parameterValues, string failReason)
        {
            _success = success;
            _failReason = failReason;
            _parameterValues = new RouteValueDictionary(parameterValues);
        }

        public static SegmentPathMatch Successful()
        {
            return Successful(null);
        }

        public static SegmentPathMatch Successful(IDictionary parameterValues)
        {
            return new SegmentPathMatch(true, parameterValues, null);
        }

        public static SegmentPathMatch Failure(string failReason)
        {
            return new SegmentPathMatch(false, null, failReason);
        }

        public bool Success
        {
            get { return _success; }
        }

        public RouteValueDictionary Values
        {
            get { return _parameterValues; }
        }

        public string FailReason
        {
            get { return _failReason; }
        }
    }
}